﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;
using ProcessControl;
using System.Data;
using MyLib;

namespace ProjectLogistics
{
    public partial class NewRequest : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            //添加提交事件
            ((ButtonList_TY)ButtonList1).BeforeSubmit += new System.ComponentModel.CancelEventHandler(NewRequest_BeforeSubmit);

        }

        //实现
        void NewRequest_BeforeSubmit(object sender, System.ComponentModel.CancelEventArgs e)
        {

            UserInfo_TY userInfo = Page.FindControl("UserInfo1") as UserInfo_TY;
            string Center = ((TextBox)userInfo.FindControl("var_CenterDepartment")).Text;

            string No = "";
            switch (Center)
            {
                case "运营管理中心[10003810]":
                    No = "YY";
                    break;
                case "市场部[1005053]":
                    No = "SC";
                    break;
                case "质量安全部[1005056]":
                    No = "ZL";
                    break;
                case "国际服务部[10003819]":
                    No = "GJ";
                    break;
                case "财务部[1005051]":
                    No = "CW";
                    break;
                case "人力资源部[1005052]":
                    No = "RL";
                    break;
                case "服务中心[1005069]":
                    No = "FW";
                    break;
                case "咨询中心[1005081]":
                    No = "ZX";
                    break;
                case "技术中心[10003812]":
                    No = "JS";
                    break;
                case "工程中心[1005062]":
                    No = "GC";
                    break;
                case "软件中心[1005086]":
                    No = "RJ";
                    break;

            }
            DateTime now = DateTime.Now;
            lblITEMNUMBER.Text = No + "-" + now.ToString("yyyyMMddhh24mmssffff").Substring(0, 17);
            fld_ITEMNUMBER.Text = No + "-" + now.ToString("yyyyMMddhh24mmssffff").Substring(0, 17);
        }

        //多行添加
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            UserInfo_TY userInfo = Page.FindControl("UserInfo1") as UserInfo_TY;
            userInfo.AddNewRow(fld_detail_PROC_ITEMREIM_DETAIL);
        }

        //多行删除
        protected void fld_detail_PROC_ITEMREIM_DETAIL_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            UserInfo_TY userInfo = Page.FindControl("UserInfo1") as UserInfo_TY;
            userInfo.DeleteRow(fld_detail_PROC_ITEMREIM_DETAIL, e);
        }
    }
}